package com.example.controller.before;

import com.example.entity.Feedback;
import com.example.service.FeedbackService;
import com.example.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "小程序反馈模块")
@CrossOrigin
@RequestMapping("/feedbackBefore")
@RestController
public class FeedbackControllerBefore {

    @Autowired
    private FeedbackService feedbackService;

    @ApiOperation(value = "发送反馈")
    @PostMapping("addFeedback")
    public R addFeedback(
            @ApiParam(name = "feedback", value = "反馈", required = true) @RequestBody Feedback feedback
    ) {
        boolean b = feedbackService.save(feedback);
        if (b) {
            return R.ok();
        } else {
            return R.error();
        }
    }
}
